/**
 * 添加或者修改页面
 */
var HxOrderOutInfoDlg = {
    data: {
        customerId: "",
        customerName: "",
        orderState: "",
        peisongTime: "",
        orderOutNumber: "",
        orderType: "",
        setUnitId: "",
        setUnit: "",
        getWarehouseId: "",
        getWarehouse: "",
        getUnitId: "",
        getUnit: "",
        goodsNum: "",
        outNum: "",
        zNum: "",
        lNum: "",
        putVolume: "",
        createUserName: "",
        submitUserName: "",
        revokeUserName: "",
        createTime: "",
        submitTime: "",
        revokeTime: "",
        completeTime: "",
        notes: "",
        associationOrder: "",
        associationOrderType: "",
        goodsId: "",
        goodsName: "",
        goodsNumber: "",
        goodsPcode69: "",
        goodsSpecs: "",
        unit: "",
        rate: "",
        psNum: "",
        v1: "",
        v2: "",
        v3: "",
        v4: "",
        v5: "",
        v6: "",
        deptId: "",
        deliverId: ""
    }
};

layui.use(['form', 'admin', 'ax','laydate'], function () {
    var $ = layui.jquery;
    var $ax = layui.ax;
    var form = layui.form;
    var admin = layui.admin;
    var laydate = layui.laydate;

    laydate.render({
        elem:'#updateTime'
        ,type:'datetime'
    });

    //让当前iframe弹层高度适应
    admin.iframeAuto();


    //表单提交事件
    form.on('submit(btnSubmit)', function (data) {
        var index;
        $.ajax({
            url:Feng.ctxPath + "/hxBasicGoods/products",
            cache: false,
            dataType:"json",
            data:data.field,
            beforeSend:function(){
                //弹出加载中
                index = layer.msg('确认中。。。请耐心等待', {
                    icon: 16,
                    shade: [0.2,'#000'], //0.1透明度的白色背景
                    time: false
                });
            },
            success:function(data){
                parent.layer.close(index);
                var Indexs = parent.layer.getFrameIndex(window.name);
                if (data.success) {
                    parent.submit = 1
                    parent.layer.close(Indexs);
                    Feng.success("提交成功！");
                } else {
                    var msg =  layer.open({
                        title: '提示' ,
                        content: data.message,
                        btn: ['确定'],
                        yes: function (){
                            layer.close(msg);
                            Feng.error("提交失败！");
                        }
                    });
                }
            },
            error:function(data){
                parent.layer.close(index);
                Feng.error("提交失败！" + data.responseJSON.message)
            }
        })
        return false;
    });

    //返回按钮
    $("#backupPage").click(function () {
        var Indexs = parent.layer.getFrameIndex(window.name);
        parent.layer.close(Indexs);
    });

});